<?php

class Password
{
	private function __construct(){}
	
	public function generate($length = 16)
	{
		$chars = "abcdefghijklmnopqrstuvwxyz0123456789";
		
		$pwd = "";
		
		for($i = 0; $i < $length; $i++)
		{
			$pwd .= $chars[rand(0, strlen($chars)-1)];
		}
		
		return $pwd;
	}
	
	public function encrypt($username, $password)
	{
		return sha1(strtoupper($username).":".strtoupper($password));
	}
}

?>